#:import gch kivy.utils.get_color_from_hex
#:import Animation kivy.animation.Animation


<ShrineToolbar>
    size_hint_y: None
    height: "42dp"
    padding: "10dp"

    PreviousImage:
        id: button_menu
        source: f"{environ['SHRINE_ROOT']}/assets/images/menu.png"
        size_hint_x: None
        width: root.height
        on_release:
            Animation(size=(0, 0), d=.2).start(self)
            root.set_title_animation_text("MENU")
            button_logo.disabled = False
            root.parent.hide_image_list()
            root.parent.ids.box_bottom_sheet.hide_box_bottom_sheet()

    PreviousImage:
        id: button_logo
        source: f"{environ['SHRINE_ROOT']}/assets/images/logo.png"
        size_hint_x: None
        width: root.height
        disabled: True
        on_release:
            Animation(size=(root.height, root.height), d=.2).start(button_menu)
            root.set_title_animation_text(root.title)
            self.disabled = True
            root.parent.open_image_list()
            root.parent.ids.box_bottom_sheet.restore_width_bottom_sheet()
            root.parent.ids.box_bottom_sheet.restore_opacity_bottom_sheet()

    MDLabel:
        id: title
        text: root.title
        bold: True
        color: root.theme_cls.text_color
        adaptive_width: True

    Widget:
        size_hint_x: None
        width: "10dp"

    MDTextField:
        id: search_field
        pos_hint: {"center_y": .5}
        disabled: True
        opacity: 0
        color_mode: "custom"
        font_size: "14sp"
        line_color_focus: root.theme_cls.opposite_bg_normal
        on_focus: if not self.focus: self.text = ""; root.set_search_field()

    MDIconButton:
        icon: "magnify"
        pos_hint: {"center_y": .5}
        on_release: root.set_search_field()

    MDIconButton:
        id: button_tune
        icon: "tune"
        pos_hint: {"center_y": .5}
